<%-- Created by IntelliJ IDEA. --%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
  <head>
    <title></title>
  </head>
  <script type="text/javascript" src="js/jquery-1.12.4.js"></script>
  <script type="text/javascript">
    $(function () {
      if($("table tr").next().text()==""){
        location.href = "ListServlet";
      }
    })
  </script>
  <body>
      <div>
        <button onclick="location.href='add.jsp'">添加水果</button>
        <table border="1">
          <tr>
            <th>类别</th>
            <th>品种</th>
            <th>产地</th>
            <th>总重量(公斤)</th>
            <th>单价(元/公斤)</th>
            <th>操作</th>
          </tr>
          <c:forEach items="${list}" var="a">
            <tr>
              <td>${a.type}</td>
              <td>${a.breed}</td>
              <td>${a.area}</td>
              <td>${a.weight}</td>
              <td>${a.price}</td>
              <td>
                <a href="QueryServlet?id=${a.fruitId}">详情</a>
                <a href="DeleteServlet?id=${a.fruitId}">删除</a>
              </td>
            </tr>
          </c:forEach>
        </table>
      </div>

  </body>
</html>